#include<iostream>

using namespace std;
const int N=5100;

int Relative[N];
int find(int x)
{
	return Relative[x]==x?x:Relative[x]=find(Relative[x]);
}

bool issame(int x,int y)
{
	return find(x)==find(y);
}

void un(int x,int y)
{
	int fx=find(x);
	int fy=find(y);
	Relative[fx]=fy;
}
int main()
{
	int n,m,p;cin>>n>>m>>p;

	for(int i=1;i<=n;i++)
	{
		Relative[i]=i;
	}
	while(m--)
	{
		int m1,m2;
		cin>>m1>>m2;
		un(m1,m2);
	}

	while(p--)
	{
		int m1,m2;
		cin>>m1>>m2;
		if(issame(m1,m2))
		{
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
}